﻿using System;
using System.Collections.Generic;

namespace MSL.Utility.Sort
{
    /// <summary>
    /// 排序基类
    /// </summary>
    public class SortBase
    {
        /// <summary>
        /// 将m 与 n 处的元素交换 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="list">集合</param>
        /// <param name="m"></param>
        /// <param name="n"></param>
        /// <returns></returns>
        public IList<T> Swap<T>(IList<T> list, int m, int n) where T : IComparable
        {
            T temp = list[n];
            list[n] = list[m];
            list[m] = temp;
            return list;
        }
    }
}
